<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>加入公司</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/company.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
</head>
<body>
<div class="viewport">
    <div class="header">
       <div class="header-1">
           <a href="javascrpt:void(0)" id="join" class="header-2">
              <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
           </a>
           <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=company&prefix=3g_company&entrance=yes" class="back" id="back">返回</a>
           <span class="span-num">WWP12520</span>
       </div>
    </div>
    <form method="post" id="myForm" action="/wape-web/api/core/centerService">
        <div class="content m-top">
            <div class="content3-4">
                <div class="blank-1"></div>
                <div class="content3-4-2">
                    <span class="span-3"><b class="span-3-1">${querycompany.companyName}</b></span><input type="submit" value="确定加入" class="input-1">
                </div>
            </div>
            <div class="content3-1">
                <div class="blank-m">
                    <input type="hidden" name="serviceCode" value="MMZS134" />
                    <input type="hidden" name="companyId" value="${querycompany.companyId}" />
                    <input type="hidden" name="companyName" value="${querycompany.companyName}" />
                    <input type="hidden" name="departmentId" id="departmentId" />
                    <input type="hidden" name="departmentName" id="departmentName" />
                </div>
                <div class="content3-1-1">
                    <table>
                        <tr>
                            <td class="td-3">法定代表人：</td>
                            <td class="td-4"><input type="text" readonly="readonly" value="${querycompany.legalRepresentative}"></td>
                        </tr>
                        <tr>
                            <td class="td-3">联系人电话：</td>
                            <td class="td-4"><input type="text" readonly="readonly" value=""></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="blank"></div>
             <c:forEach var="dp" items="${departs}">
                <c:if test="${dp.levelNum eq '2' and dp.type eq '1'}">
                    <div class="content3-2 open-active" id="open-active">
		                <div class="content3-2-1">
		                <a href="javascript:void(0)"><img src="<%=basepath%>images/b48.png" class="img-4"><span class="span3-1">${dp.sonDepart}</span>
		                <input value="${dp.departmentId}" name="dps" type="radio" class="input3-1"></a> 
		                </div>
		            </div>
                     <div class="content3-2 none close-active" id="close-active">
                        <c:forEach var="dp2" items="${departs}">
                            <c:if test="${dp2.type eq '1' and dp2.fatherId eq dp.departmentId}">
                                <div class="content3-2-1">
				                    <span class="span3-2">${dp2.sonDepart}</span><input value="${dp2.departmentId}" name="dps" type="radio" class="input3-1">
				                </div>
                            </c:if>
                        </c:forEach>
                    </div>
                </c:if>
            </c:forEach> 
            <div class="blank-m"></div>
            <div class="space"></div>
        </div>
    </form>
</div>
</body>
<script type="text/javascript">
    /*错误提示*/
    $(function(){
        var error = "${requestScope.returnMsg}";
        if(error != "" && error != "成功!"){
            layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
        }
    });
    /*展开*/
    $(function(){
        $(".open-active").click(function(){
            $(this).next(".close-active").fadeToggle(200);
            $(this).find(".img-4").toggleClass("rotation",200);
        });
    });
    /*radio*/
    $(function(){
    	$(".content3-2-1 input").click(function(){
    		var radio = $('.content3-2-1 input:radio:checked').val();
        	var span = $('.content3-2-1 input:radio:checked').siblings(".content3-2-1 span").text();
        	$("#departmentId").val(radio);
        	$("#departmentName").val(span);
    	});
    });
    /*表单提交*/
    $(function(){
    	$("#myForm").submit(function(){
    		var radio = $('.content3-2-1 input:radio:checked').val();
    		//alert(radio)
    		if(radio == undefined || radio == ""){
    			layer.msg("请选择部门",{shadeClose:true,shade:0.1,time:2000});
                return false;
    		}
    		else{
    			layer.load();
    			setTimeout(function(){
              	  layer.closeAll();
              	  layer.msg("网络异常，请重新尝试！",{shadeClose:true,shade:0.1,time:2000});
              	}, 30000);
    		}
    	});
    });
</script>
</html>

